package cn.edu.hitsz.http;

import java.net.URL;

/**
 * THE CLASS CONTAINS THE CONTENT AND THE REFERENCE OF THE FETCHED REQUEST
 * 
 * @author mingchen
 * @date 2015年8月13日
 */
public class HTTPResponse {
	// reference and the content
	private URL reference;
	private String content;

	/**
	 * 
	 * Constructor function of Class
	 */
	public HTTPResponse() {
	}

	/**
	 * 
	 * Constructor function of Class
	 * 
	 * @param url
	 * @param content
	 */
	public HTTPResponse(URL url, String content) {
		reference = url;
		this.content = content;
	}

	/**
	 * @return the reference
	 */
	public URL getReference() {
		return reference;
	}

	/**
	 * @param reference
	 *            the reference to set
	 */
	public void setReference(URL reference) {
		this.reference = reference;
	}

	/**
	 * @return the content
	 */
	public String getContent() {
		return content;
	}

	/**
	 * @param content
	 *            the content to set
	 */
	public void setContent(String content) {
		this.content = content;
	}

	/**
	 * Get the string form of the URL
	 * 
	 * @return String 2015年8月13日
	 */
	public String getURLs() {
		return reference.toString();
	}

	/**
	 * Override the toString method
	 */
	@Override
	public String toString() {
		String str = reference.toString() + "\n" +
				"The size of the content:"
				+ content.length();
		return str;
	}
}
